package com.ran.service;

import com.ran.dao.BookDao;
import com.ran.impl.BookDaoImpl;
import com.ran.po.Book;

import java.util.List;

public class BookService implements IBookServcie{

    private BookDao bookDao;

    public BookService() {
        this.bookDao = new BookDaoImpl();
    }

    @Override
    public boolean add(Book book) {
        return bookDao.add(book)==1?true:false;
    }

    @Override
    public boolean delete(String number) {
        return bookDao.delete(number)==1?true:false;
    }

    @Override
    public boolean update(Book book) {
        return bookDao.update(book)==1?true:false;
    }

    @Override
    public Book getById(String number) {
        return bookDao.getById(number);
    }

    @Override
    public List<Book> getAll() {
        return bookDao.getAll();
    }
}
